-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add mock artifacts plugins #5741
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
hardhatTotal size of the bundle: List of dependencies (sorted by size)
|
db90e56
to
4ec1245
Compare
4ec1245
to
08f0627
Compare
08f0627
to
ee0ebf2
Compare
ee0ebf2
to
2781e9b
Compare
2781e9b
to
bb2b537
Compare
Add an in-built plugin that `extends` the HRE with an `artifacts` implementation based on the v2 interface.
We add a `createMockHardhatRuntimeEnvironment` that overrides the standard artifacts built-in plugin and substitutes in a mock version that can be leveraged in tests and development. There is a supporting test to show the usage of the mocked artifacts manager.
bb2b537
to
4f99632
Compare
By making not implemented an explicit error, we can track it in the code base (which is hardher if we piggy back on another error type).
v-next/hardhat/src/internal/builtin-plugins/artifacts/hookHandlers/hre.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a minor comment, but looks good to me
Match the pattern used for the network manager loading. This is the only category of hook where we lazily load as it is loaded every time the HRE is setup.
While the build system is under development, this PR adds a temporary artifacts plugin that adds a fake artifacts manager to the
hre
underhre.artifacts
.This
hre.artifacts
will be replaced, but for the moment you can code against it by leveragingcreateMockHardhatRuntimeEnvironment
in your tests. This will apply a mock artifacts plugin that you can use in your tests like so: